<?php

if (!isset($_GET['op'])) {
    // header('HTTP/1.1 403 ');
    echo '参数错误，未授权的操作';
    return;
}

	$op = $_GET['op'];
	if ($op == 1) {
	$title = 'Message Board Register';
	$action = url('auth/registerAction');
	$button = 'Register right now';
	$address = 'register?op=2';
	$btnText = 'login';
	$reminder = 'I have already signed up,';

	
}


if ($op == 2) {
	$title = 'Message Board Login';
	$action = url('auth/loginAction');
	$button = 'Login';
	$address = 'register?op=1';
	$btnText = 'register';
	$reminder = 'No account yet,';

}

?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title><?= $title ?></title>
	<link rel="stylesheet" type="text/css" href="<?= assets('css/register.css') ?>">
</head>
<body>
	<div id="wrapper">
		<form method="post" action="<?= $action ?>" enctype="multipart/form-data">
			<?php if ($op == 1): ?>
			<div class="input">
				<label for="id">id</label>
				<input type="text" name="id" id="id" placeholder="Please input id" <?php if ($op == 1): ?>value="<?= $inputBag['id'] ?><?php endif; ?>">
			</div>
			<div class="row">
				<?php echo $errorBag['id'] ?>
			</div>
			<?php endif; ?>
				<div class="input">
				<label for="email">email</label>
				<input type="email" name="email" id="email" placeholder="Please input email" <?php if ($op == 1): ?>value="<?= $inputBag['email'] ?><?php endif; ?>">
			</div>
			<div class="row">
				<?php echo $errorBag['email'] ?>
			</div>
			<?php if ($op == 1): ?>
			<div class="input">
				<label for="userName">Username</label>
				<input type="text" name="userName" id="userName" placeholder="Please input username" <?php if ($op == 1): ?>value="<?= $inputBag['userName'] ?><?php endif; ?>">
			</div>
			<div class="row">
				<?php echo $errorBag['userName'] ?>
			</div>
			<?php endif; ?>
			<div class="input">
				<label for="password">Password</label>
				<input type="password" name="password" id="password" placeholder="Please input password">
			</div>
			<div class="row">
				<?php echo $errorBag['password'] ?>
			</div>
			<?php if ($op == 1): ?>
			<div class="input">
				<label for="pwdConfirm">Pwdconfirm</label>
				<input type="password" name="pwdConfirm" id="pwdConfirm" placeholder="Please input pwdConfirm">
			</div>
			<div class="row">
				<?php echo $errorBag['pwdConfirm'] ?>
			</div>
			<?php endif; ?>
			<!-- <?php if ($op == 1): ?>
			<div class="input">
				<label for="avatar">avatar</label>
				<input type="file" name="avatar" id="avatar">
			</div>
			<div class="row">
				<?php if ($hasError) echo $errorBag['avatar'] ?>
			</div>
			<?php endif;?>
			<div class="input">
				<label for="verificationCode">verification</label>
				<input type="text" name="verificationCode" id="verificationCode" placeholder="Please input verification code">
			</div>
			<div style="width: 362px; height: 100px;">
				<img src="<?= assets('img/code.php') ?>" id="code" onclick="JavaScript:this.src='img/code.php?tm='+Math.random()" />
			</div>
			<div class="row">
				<?php if ($hasError) echo $errorBag['verificationCode'] ?>
			</div> -->
			<?php if ($op == 2): ?>
			<div style="height: 30px;">
				<input type="checkbox" name="remenberMe" id="remenberMe" value="1">
				<label for="remenberMe">Rember me</label>
				<input type="checkbox" name="autoLogon" id="autoLogon" value="2">
				<label for="autoLogon">Automatic Login</label>
			</div>
			<?php endif; ?>
			<div class="input">
				<input type="submit" value="<?= $button ?>" class="register">
			</div>
			<span class="login">
				<span><?= $reminder ?></span>
				<a href="<?= $address ?>"><?= $btnText ?></a>
				<span>right now</span>
			</span>
		</form>
	</div>
</body>
</html>